package cn.seqdata.forecast.model;

import java.util.HashMap;

import org.joda.time.Interval;
import org.joda.time.Period;
import org.joda.time.ReadableInterval;
import org.joda.time.ReadablePeriod;

public class ModelParams extends HashMap<String, Object> {
    private static final long serialVersionUID = 1L;

    public static final String INTERVAL = "interval";
    public static final String PERIOD = "period";
    public static final String LENGTH = "length";

    public ReadableInterval getInterval() {
        return Interval.parse(get(INTERVAL).toString());
    }

    public void setInterval(ReadableInterval interval) {
        put(INTERVAL, interval.toString());
    }

    public ReadablePeriod getPeriod() {
        return Period.parse(get(PERIOD).toString());
    }

    public void setPeriod(ReadablePeriod period) {
        put(PERIOD, period.toString());
    }

    public Integer getLength() {
        return Integer.valueOf(get(LENGTH).toString());
    }

    public void setLength(Integer length) {
        put(LENGTH, length.toString());
    }

    public Integer getInteger(String key){
        return Integer.valueOf(get(key).toString());
    }

    public Double getDouble(String key){
        return Double.valueOf(get(key).toString());
    }
}
